<!DOCTYPE html>

<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">

<title>module Sycstring - Your application title</title>

<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
</script>

<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>


<body id="top" class="module">
<nav id="metadata">
  <nav id="home-section" class="section">
  <h3 class="section-header">
    <a href="./index.html">Home</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </h3>
</nav>


  <nav id="search-section" class="section project-section" class="initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <h3 class="section-header">
      <input type="text" name="search" placeholder="Search" id="search-field"
             title="Type to search, Up and Down to navigate, Enter to load">
    </h3>
  </form>

  <ul id="search-results" class="initially-hidden"></ul>
</nav>


  <div id="file-metadata">
    <nav id="file-list-section" class="section">
  <h3 class="section-header">Defined In</h3>
  <ul>
    <li>lib/sycstring/string_util.rb
  </ul>
</nav>

    
  </div>

  <div id="class-metadata">
    
    
    
    <!-- Method Quickref -->
<nav id="method-list-section" class="section">
  <h3 class="section-header">Methods</h3>

  <ul class="link-list">
    
    <li><a href="#method-i-split_lines">#split_lines</a>
    
  </ul>
</nav>

  </div>

  <div id="project-metadata">
    <nav id="fileindex-section" class="section project-section">
  <h3 class="section-header">Pages</h3>

  <ul>
  
    <li class="file"><a href="./README_rdoc.html">README</a>
  
  </ul>
</nav>

    <nav id="classindex-section" class="section project-section">
  <h3 class="section-header">Class and Module Index</h3>

  <ul class="link-list">
  
    <li><a href="./Syctask.html">Syctask</a>
  
    <li><a href="./Syctask/Evaluator.html">Syctask::Evaluator</a>
  
    <li><a href="./Syctask/Meeting.html">Syctask::Meeting</a>
  
    <li><a href="./Syctask/Scanner.html">Syctask::Scanner</a>
  
    <li><a href="./Syctask/Schedule.html">Syctask::Schedule</a>
  
    <li><a href="./Syctask/Settings.html">Syctask::Settings</a>
  
    <li><a href="./Syctask/Statistics.html">Syctask::Statistics</a>
  
    <li><a href="./Syctask/Task.html">Syctask::Task</a>
  
    <li><a href="./Syctask/TaskPlanner.html">Syctask::TaskPlanner</a>
  
    <li><a href="./Syctask/TaskScheduler.html">Syctask::TaskScheduler</a>
  
    <li><a href="./Syctask/TaskService.html">Syctask::TaskService</a>
  
    <li><a href="./Syctask/TaskTracker.html">Syctask::TaskTracker</a>
  
    <li><a href="./Syctask/Times.html">Syctask::Times</a>
  
    <li><a href="./Syctask/Track.html">Syctask::Track</a>
  
    <li><a href="./Sycutil.html">Sycutil</a>
  
    <li><a href="./Sycutil/Console.html">Sycutil::Console</a>
  
    <li><a href="./ConsoleTimer.html">ConsoleTimer</a>
  
    <li><a href="./Object.html">Object</a>
  
    <li><a href="./Sycstring.html">Sycstring</a>
  
    <li><a href="./Syctime.html">Syctime</a>
  
  </ul>
</nav>

  </div>
</nav>

<div id="documentation">
  <h1 class="module">module Sycstring</h1>

  <div id="description" class="description">
    
<p><a href="Sycstring.html">Sycstring</a> provides functions for string
operations</p>

  </div><!-- description -->

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    

    <!-- Methods -->
    
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
      <h3 class="section-header">Public Instance Methods</h3>

    
      <div id="method-i-split_lines" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">split_lines</span><span
            class="method-args">(string, length)</span>
          <span class="method-click-advice">click to toggle source</span>
        </div>
        

        <div class="method-description">
          
          <p>Splits a string to size (chars) less or equal to length</p>
          

          
          <div class="method-source-code" id="split_lines-source">
            <pre><span class="ruby-comment"># File lib/sycstring/string_util.rb, line 5</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">split_lines</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">length</span>)
  <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">&quot; &quot;</span>).<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\n&quot;</span>)
  <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
  <span class="ruby-identifier">new_lines</span> = []
  <span class="ruby-identifier">new_lines</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">line</span>.<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">&quot; &quot;</span>).<span class="ruby-identifier">split</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">w</span><span class="ruby-operator">|</span>
      <span class="ruby-keyword">if</span> <span class="ruby-identifier">new_lines</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">length</span>
        <span class="ruby-identifier">new_lines</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;#{w} &quot;</span>
      <span class="ruby-keyword">else</span>
        <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
        <span class="ruby-identifier">new_lines</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-node">&quot;#{w} &quot;</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
    <span class="ruby-identifier">new_lines</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">text</span> = <span class="ruby-string">&quot;&quot;</span>
  <span class="ruby-identifier">new_lines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{l}\n&quot;</span>}
  <span class="ruby-identifier">text</span>.<span class="ruby-identifier">chomp</span>
<span class="ruby-keyword">end</span></pre>
          </div><!-- split_lines-source -->
          
        </div>

        

        
      </div><!-- split_lines-method -->

    
    </section><!-- public-instance-method-details -->
  
  </section><!-- 5Buntitled-5D -->

</div><!-- documentation -->


<footer id="validator-badges">
  <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
  <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
  <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>

